﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMES.Domain.zyy;
using MyMES.Error;
using MyMES.Read.API.Application.Command.Pressions;

namespace MyMES.Read.API.Controllers.ZYY.Pressions
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PressionController : ControllerBase
    {
        private readonly IMediator med;

        public PressionController(IMediator med)
        {
            this.med = med;
        }
        [HttpGet]
        public async Task<APIResult<List<Pression>>> GetPression([FromQuery] PressionCommand request, CancellationToken cancellationToken)
        {
            try
            {
                return await med.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
         
        }
    }
}
